﻿<UserControl x:Class="NewProfileForm" x:Name="npf1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             Height="520" Width="400" MaxWidth="400">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <TextBlock Margin="4" Text="Registering new profile" HorizontalAlignment="Center" FontSize="16"/>
        <GroupBox Header="Profile data" Grid.Row="1" Margin="4">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                
                <TextBlock  Margin="4" VerticalAlignment="Center" Text="Name"/>
                <TextBox Margin="4" Grid.Column="1" Text="{Binding ElementName=npf1, Path=Profile.Name}" x:Name="tbName" TextChanged="TextChanged"/>
                <TextBlock Grid.Row="1" Margin="4" VerticalAlignment="Center" Text="Surname"/>
                <TextBox Margin="4" Grid.Row="1" Grid.Column="1" Text="{Binding ElementName=npf1, Path=Profile.Surname}" x:Name="tbSurname" TextChanged="TextChanged"/>
                <TextBlock Grid.Row="2" Margin="4" VerticalAlignment="Center" Text="Organization"/>
                <TextBox Margin="4" Grid.Row="2" Grid.Column="1" Text="{Binding ElementName=npf1, Path=Profile.Organization}" x:Name="tbOrganization" TextChanged="TextChanged"/>
                <TextBlock Grid.Row="3" Margin="4" VerticalAlignment="Center" Text="Organiz. Unit"/>
                <TextBox Margin="4" Grid.Row="3" Grid.Column="1" Text="{Binding ElementName=npf1, Path=Profile.OragnizationUnit}" x:Name="tbOrganizationUnit" TextChanged="TextChanged"/>
                <TextBlock Grid.Row="4" Margin="4" VerticalAlignment="Center" Text="Email"/>
                <TextBox Margin="4" Grid.Row="4" Grid.Column="1" Text="{Binding ElementName=npf1, Path=Profile.eMailAddress}"  x:Name="tbEmail" TextChanged="TextChanged"/>
                <TextBlock Grid.Row="5" Margin="4" VerticalAlignment="Center" Text="Country"/>
                <ComboBox Name="ComboCountry" Grid.Row="5" Grid.Column="1" Margin="4" SelectionChanged="ComboCountry_SelectionChanged" SelectedIndex="0" >
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name}"/>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
            </Grid>
        </GroupBox>
        
        <GroupBox Header="Login data" Margin="4" Grid.Row="2">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <TextBlock  Margin="4" VerticalAlignment="Center" Text="User Name"/>
                <TextBox Margin="4" Grid.Column="1" Text="{Binding ElementName=npf1, Path=Profile.UserName}" x:Name="tbUsername" TextChanged="TextChanged"/>
                <TextBlock Grid.Row="1" Margin="4" VerticalAlignment="Center" Text="Password"/>
                <PasswordBox Margin="4" Grid.Row="1" Grid.Column="1" PasswordChar="*" x:Name="tbPassword" PasswordChanged="PasswordChanged"/>
                <TextBlock Grid.Row="2" Margin="4" VerticalAlignment="Center" Text="Confirm Passowrd"/>
                <PasswordBox Margin="4" Grid.Row="2" Grid.Column="1" x:Name="tbPasswordAgain" PasswordChanged="PasswordChanged"/>
                
                <GroupBox Header="Status" Grid.Row="3" Grid.ColumnSpan="2" Margin="4">
                    <TextBlock Margin="4" x:Name="textStatus" TextWrapping="Wrap"/>
                </GroupBox>
            </Grid>
        </GroupBox>
        
        <GroupBox Margin="3" Header="RSA Key Length" Grid.Row="3">
            <DockPanel>
                <TextBlock Text="Key Length:" DockPanel.Dock="Left" Margin="3" VerticalAlignment="Center"/>
                <ComboBox x:Name="cbKeylength" Margin="3" SelectionChanged="ComboKeylength_SelectionChanged" SelectedIndex="0" SelectedValuePath="Content">
                    <ComboBox.Items>
                        <ComboBoxItem Content="1024"/>
                        <ComboBoxItem Content="1536"/>
                        <ComboBoxItem Content="2048"/>
                        <ComboBoxItem Content="4096"/>
                    </ComboBox.Items>
                </ComboBox>
                
            </DockPanel>
        </GroupBox>
        
        <StackPanel Margin="4" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button x:Name="buttonOk" Content="Ok" Margin="4" Height="30" Width="100" Click="buttonOkCancel_Click" IsEnabled="{Binding ElementName=npf1, Path=IsDataOk}"/>
            <Button x:Name="buttonCancel" Content="Cancel" Margin="4" Height="30" Width="100" Click="buttonOkCancel_Click"/>
        </StackPanel>
    </Grid>
</UserControl>
